Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LLVM]Fix symbol visibility macros not being define for AIX #107705

Merged
merged 1 commit into from
Sep 9, 2024

Conversation

fsfod
Copy link
Contributor

@fsfod fsfod commented Sep 7, 2024

This is to try and fix buildbot failure on clang-ppc64-aix from my changes in #96630. I don't really know much about AIX so it would be good to have someone more knowledgeable to say if visibility macros on extern templates is needed on AIX similar to ELF. @compnerd @tstellar

@llvmbot
Copy link
Member

llvmbot commented Sep 7, 2024

@llvm/pr-subscribers-llvm-support

Author: Thomas Fransham (fsfod)

Changes

This is to try and fix buildbot failure on clang-ppc64-aix from my changes in #96630. I don't really know much about AIX so it would be good to have someone more knowledgeable to say if visibility macros on extern templates is needed on AIX similar to ELF. @compnerd @tstellar


Full diff: https://github.com/llvm/llvm-project/pull/107705.diff

1 Files Affected:

  • (modified) llvm/include/llvm/Support/Compiler.h (+1-1)
diff --git a/llvm/include/llvm/Support/Compiler.h b/llvm/include/llvm/Support/Compiler.h
index 140ff611af79fb..1d2d751d4dc11a 100644
--- a/llvm/include/llvm/Support/Compiler.h
+++ b/llvm/include/llvm/Support/Compiler.h
@@ -189,7 +189,7 @@
 #define LLVM_TEMPLATE_ABI __declspec(dllimport)
 #define LLVM_EXPORT_TEMPLATE
 #endif
-#elif defined(__ELF__) || defined(__MINGW32__)
+#elif defined(__ELF__) || defined(__MINGW32__) || defined(_AIX)
 #define LLVM_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #define LLVM_TEMPLATE_ABI LLVM_ATTRIBUTE_VISIBILITY_DEFAULT
 #define LLVM_EXPORT_TEMPLATE

fsfod referenced this pull request Sep 9, 2024
…ty annotations

These are my initial build and code changes to supporting building llvm
as shared library/DLL on windows(without force exporting all symbols)
and making symbol visibility hidden by default on Linux which adding
explicit symbol visibility macros to the whole llvm codebase.

Updated cmake code to allow building llvm-shlib on windows by appending
/WHOLEARCHIVE:lib to the linker options.
Remove the hardcoded CMake error from using LLVM_BUILD_LLVM_DYLIB on
windows.
Updated CMake to define new macros to control conditional export macros
in llvm/Support/Compiler.h
Use /Zc:dllexportInlines- when compiling with clang-cl on windows with a
opt out CMake option to disable using it.
Replace some use of LLVM_EXTERNAL_VISIBILITY with new export macros.

Some of the cmake and code changes are based on @tstellar's earlier PR
#67502.

I have Windows building using clang-cl, while for MSVC its at-least able
to build libllvm, but some tests can't build because llvm iterator
template metaprogramming that doesn't work well with dllexport. Linux
should build without issue. My full branch is here
https://github.com/fsfod/llvm-project/tree/llvm-export-api-20.0 and
including all the auto generated export macros from clang tooling based
system.
Copy link
Member

@jakeegan jakeegan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on AIX. LGTM, thanks!

@fsfod
Copy link
Contributor Author

fsfod commented Sep 9, 2024

I don't have commit access if you want to merge it for me.

@jakeegan jakeegan merged commit 8694353 into llvm:main Sep 9, 2024
10 checks passed
VitaNuo pushed a commit to VitaNuo/llvm-project that referenced this pull request Sep 12, 2024
)

This is to try and fix buildbot failure on
[clang-ppc64-aix](https://lab.llvm.org/buildbot/#/builders/64/builds/881)
from my changes in llvm#96630. I don't really know much about AIX so it
would be good to have someone more knowledgeable to say if visibility
macros on extern templates is needed on AIX similar to ELF. @compnerd
@tstellar
@fsfod fsfod deleted the export-api-aix-fix branch October 14, 2024 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants